﻿Imports System.ComponentModel
Imports System.Data
Partial Class Control_ucDropDownList
    Inherits controlMatrix 'System.Web.UI.UserControl
    'Protected mCaption As String
    '<Description("設定顯示名"), Category("LaiyiFan"), DefaultValue("設定顯示名")> _
    'Public Property Caption() As String
    '    Get
    '        Return mCaption
    '    End Get
    '    Set(ByVal value As String)
    '        mCaption = value
    '    End Set
    'End Property
    Public Sub SetData(ByVal p_table As DataTable, ByVal p_TextField As String, ByVal p_ValueField As String)        
        ddl.DataSource = p_table
        ddl.DataTextField = p_TextField
        ddl.DataValueField = p_ValueField
        ddl.DataBind()
    End Sub
    Public Sub SetData(ByVal p_table As DataTable, ByVal p_TextFieldPOS As Integer, ByVal p_ValueFieldPOS As Integer)
        If (p_table.Columns.Count = 1) Then
            p_ValueFieldPOS = 0
        End If
        SetData(p_table, p_table.Columns(p_TextFieldPOS).ColumnName _
                , p_table.Columns(p_ValueFieldPOS).ColumnName)
    End Sub
    Public Function GetSelectItemValue() As String
        Return ddl.SelectedValue
    End Function

End Class
